package cn.tedu.qxhouserent.passport.pojo.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Accessors(chain = true)
public class AdminAddNewParam implements Serializable {

    @NotEmpty(message = "添加管理员失败，请填写用户名！")
    @Pattern(regexp = "(^[a-zA-Z][a-zA-Z0-9_-]{3,15}$)", message = "添加管理员失败，用户名必须是4~16个由字母、数字、下划线、减号组成的字符，且第1个字符必须是字母！")
    private String username;

    @NotEmpty(message = "添加管理员失败，请填写密码！")
    @Pattern(regexp = "(^.{4,16}$)", message = "添加管理员失败，密码必须是4~16字符！")
    private String password;

    @NotEmpty(message = "添加管理员失败,请上传头像!")
    @ApiModelProperty(value = "头像",required = true)
    private String avatar;

    @NotEmpty(message = "添加管理员失败,请选择性别!")
    @Pattern(regexp = "(男|女)", message = "性别只能为“男”或“女”")
    @ApiModelProperty(value = "性别",required = true)
    private String gender;

    @NotNull(message = "添加管理员失败,请填写年龄!")
    @Range(min = 18,max = 100,message = "请提交合法的年龄")
    @ApiModelProperty(value = "年龄",required = true)
    private Integer age;

    @NotEmpty(message = "添加管理员失败,请填写身份证!")
    @Pattern(regexp = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
            "(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",
            message = "身份证号码格式不正确")
    @ApiModelProperty(value = "身份证",required = true)
    private String idCard;

    @NotEmpty(message = "添加管理员失败,请填写手机号!")
    @Pattern(regexp = "(^1[3-9]\\d{9}$)",
            message = "手机号格式不正确")
    @ApiModelProperty(value = "手机号",required = true)
    private String phoneNumber;

    @NotEmpty(message = "添加管理员失败,请填写地址!")
    @ApiModelProperty(value = "地址",required = true)
    private String address;

    @NotEmpty(message = "添加管理员失败,请填写简介!")
    @ApiModelProperty(value = "简介",required = true)
    private String description;

    @NotNull(message = "是否启用")
    @ApiModelProperty(value = "是否启用",required = true)
    private Integer enable;

    @NotNull(message = "添加管理员失败,请添加管理员角色!")
    @ApiModelProperty(value = "角色",required = true)
    private Long[] roleIds;

}
